home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Mac OS / URL Access 1.0.1 SDK / URLAccess.p < prev    next >
Encoding:
Text File  |  1999-06-03  |  7.9 KB  |  249 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        URLAccess.p
  3.  
  4.      Contains:    URL Access Pascal interfaces.
  5.  
  6.      Version:    1.0
  7.  
  8.      Copyright:    © 1998 by Apple Computer, Inc., all rights reserved
  9.  
  10.      Bugs?:        Please include the the file and version information (from above) with
  11.                  the problem description.  Developers belonging to one of the Apple
  12.                  developer programs can submit bug reports to:
  13.  
  14.                      devsupport@apple.com
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT URLAccess;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __URLACCESS__}
  27. {$SETC __URLACCESS__ := 1}
  28.  
  29. {$I+}
  30. {$SETC URLAccessIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __TYPES__}
  34. {$I Types.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __FILES__}
  37. {$I Files.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __CODEFRAGMENTS__}
  40. {$I CodeFragments.p}
  41. {$ENDC}
  42.  
  43. { Data structures and types }
  44.  
  45. {$PUSH}
  46. {$ALIGN MAC68K}
  47. {$LibExport+}
  48.  
  49.  
  50. TYPE
  51.     URLReference = ^LONGINT;
  52.  
  53.  
  54. CONST
  55.     kURLReplaceExistingFlag        = $01;
  56.     kURLBinHexFileFlag            = $02;                            {  Binhex before uploading if necessary }
  57.     kURLExpandFileFlag            = $04;                            {  Use StuffIt engine to expand file if necessary }
  58.     kURLDisplayProgressFlag        = $08;
  59.     kURLDisplayAuthFlag            = $10;                            {  Display auth dialog if guest connection fails }
  60.     kURLUploadFlag                = $20;                            {  Do an upload instead of a download }
  61.     kURLIsDirectoryHintFlag        = $40;                            {  Hint: the URL is a directory }
  62.     kURLDoNotTryAnonymousFlag    = $80;                            {  Don't try to connect anonymously before getting logon info }
  63.     kURLDirectoryListingFlag    = $0100;                        {  Download the directory listing, not the whole directory }
  64.     kURLReservedFlag            = $80000000;                    {  reserved for Apple internal use }
  65.  
  66.  
  67. TYPE
  68.     URLOpenFlags                        = UInt32;
  69.  
  70. CONST
  71.     kURLNullState                = 0;
  72.     kURLInitiatingState            = 1;
  73.     kURLLookingUpHostState        = 2;                            {  NOT IN EXT HEADER }
  74.     kURLConnectingState            = 3;                            {  NOT IN EXT HEADER }
  75.     kURLResourceFoundState        = 4;
  76.     kURLDownloadingState        = 5;
  77.     kURLDataAvailableState        = $15;
  78.     kURLTransactionCompleteState = 6;
  79.     kURLErrorOccurredState        = 7;
  80.     kURLAbortingState            = 8;
  81.     kURLCompletedState            = 9;
  82.     kURLUploadingState            = 10;
  83.  
  84.  
  85. TYPE
  86.     URLState                            = UInt32;
  87.  
  88. CONST
  89.     kURLInitiatedEvent            = 1;
  90.     kURLResourceFoundEvent        = 4;
  91.     kURLDownloadingEvent        = 5;
  92.     kURLAbortInitiatedEvent        = 8;
  93.     kURLCompletedEvent            = 9;
  94.     kURLErrorOccurredEvent        = 7;
  95.     kURLDataAvailableEvent        = $15;
  96.     kURLTransactionCompleteEvent = 6;
  97.     kURLUploadingEvent            = 10;
  98.     kURLSystemEvent                = 29;
  99.     kURLPercentEvent            = 30;
  100.     kURLPeriodicEvent            = 31;
  101.     kURLPropertyChangedEvent    = 32;
  102.  
  103.  
  104. TYPE
  105.     URLEvent                            = UInt32;
  106.  
  107. CONST
  108.     kURLInitiatedEventMask        = $01;
  109.     kURLResourceFoundEventMask    = $08;
  110.     kURLDownloadingMask            = $10;
  111.     kURLUploadingMask            = $0200;
  112.     kURLAbortInitiatedMask        = $80;
  113.     kURLCompletedEventMask        = $0100;
  114.     kURLErrorOccurredEventMask    = $40;
  115.     kURLDataAvailableEventMask    = $00100000;
  116.     kURLTransactionCompleteEventMask = $20;
  117.     kURLSystemEventMask            = $10000000;
  118.     kURLPercentEventMask        = $20000000;
  119.     kURLPeriodicEventMask        = $40000000;
  120.     kURLPropertyChangedEventMask = $80000000;
  121.     kURLAllBufferEventsMask        = $00100020;
  122.     kURLAllNonBufferEventsMask    = $E00003D1;
  123.     kURLAllEventsMask            = $FFFFFFFF;
  124.  
  125.  
  126. TYPE
  127.     URLEventMask                        = UInt32;
  128.     URLCallbackInfoPtr = ^URLCallbackInfo;
  129.     URLCallbackInfo = RECORD
  130.         version:                UInt32;
  131.         urlRef:                    URLReference;
  132.         property:                ConstCStringPtr;
  133.         currentSize:            UInt32;
  134.         systemEvent:            EventRecordPtr;
  135.     END;
  136.  
  137. {  http and https properties }
  138. {  authentication type flags }
  139.  
  140. CONST
  141.     kUserNameAndPasswordFlag    = $00000001;
  142.  
  143. FUNCTION URLGetURLAccessVersion(VAR returnVers: UInt32): OSStatus;
  144. {$IFC TARGET_RT_MAC_CFM }
  145. {
  146.         URLAccessAvailable() is a macro/inline available only in C/C++.  
  147.         To get the same functionality from pascal or assembly, you need
  148.         to test if URLGetURLAccessVersion function is not NULL.  For instance:
  149.         
  150.             gURLAccessAvailable = FALSE;
  151.             IF @URLAccessAvailable <> kUnresolvedCFragSymbolAddress THEN
  152.                 gURLAccessAvailable = TRUE;
  153.             END
  154.     
  155.     }
  156. {$ENDC}  {TARGET_RT_MAC_CFM}
  157.  
  158.  
  159. TYPE
  160. {$IFC TYPED_FUNCTION_POINTERS}
  161.     URLNotifyProcPtr = FUNCTION(userContext: UNIV Ptr; event: URLEvent; VAR callbackInfo: URLCallbackInfo): OSStatus;
  162. {$ELSEC}
  163.     URLNotifyProcPtr = ProcPtr;
  164. {$ENDC}
  165.  
  166. {$IFC TYPED_FUNCTION_POINTERS}
  167.     URLSystemEventProcPtr = FUNCTION(userContext: UNIV Ptr; VAR event: EventRecord): OSStatus;
  168. {$ELSEC}
  169.     URLSystemEventProcPtr = ProcPtr;
  170. {$ENDC}
  171.  
  172.     URLNotifyUPP = UniversalProcPtr;
  173.     URLSystemEventUPP = UniversalProcPtr;
  174.  
  175. CONST
  176.     uppURLNotifyProcInfo = $00000FF0;
  177.     uppURLSystemEventProcInfo = $000003F0;
  178.  
  179. FUNCTION NewURLNotifyProc(userRoutine: URLNotifyProcPtr): URLNotifyUPP;
  180.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  181.     INLINE $2E9F;
  182.     {$ENDC}
  183.  
  184. FUNCTION NewURLSystemEventProc(userRoutine: URLSystemEventProcPtr): URLSystemEventUPP;
  185.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  186.     INLINE $2E9F;
  187.     {$ENDC}
  188.  
  189. FUNCTION CallURLNotifyProc(userContext: UNIV Ptr; event: URLEvent; VAR callbackInfo: URLCallbackInfo; userRoutine: URLNotifyUPP): OSStatus;
  190.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  191.     INLINE $205F, $4E90;
  192.     {$ENDC}
  193.  
  194. FUNCTION CallURLSystemEventProc(userContext: UNIV Ptr; VAR event: EventRecord; userRoutine: URLSystemEventUPP): OSStatus;
  195.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  196.     INLINE $205F, $4E90;
  197.     {$ENDC}
  198. FUNCTION URLSimpleDownload(url: ConstCStringPtr; VAR destination: FSSpec; destinationHandle: Handle; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
  199. FUNCTION URLDownload(urlRef: URLReference; VAR destination: FSSpec; destinationHandle: Handle; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
  200. FUNCTION URLSimpleUpload(url: ConstCStringPtr; {CONST}VAR source: FSSpec; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
  201. FUNCTION URLUpload(urlRef: URLReference; {CONST}VAR source: FSSpec; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
  202. FUNCTION URLNewReference(url: ConstCStringPtr; VAR urlRef: URLReference): OSStatus;
  203. FUNCTION URLDisposeReference(urlRef: URLReference): OSStatus;
  204. FUNCTION URLOpen(urlRef: URLReference; VAR fileSpec: FSSpec; openFlags: URLOpenFlags; notifyProc: URLNotifyProcPtr; eventRegister: URLEventMask; userContext: UNIV Ptr): OSStatus;
  205. FUNCTION URLAbort(urlRef: URLReference): OSStatus;
  206. FUNCTION URLGetDataAvailable(urlRef: URLReference; VAR dataSize: Size): OSStatus;
  207. FUNCTION URLGetBuffer(urlRef: URLReference; VAR buffer: UNIV Ptr; VAR bufferSize: Size): OSStatus;
  208. FUNCTION URLReleaseBuffer(urlRef: URLReference; buffer: UNIV Ptr): OSStatus;
  209. FUNCTION URLGetProperty(urlRef: URLReference; property: ConstCStringPtr; propertyBuffer: UNIV Ptr; bufferSize: Size): OSStatus;
  210. FUNCTION URLGetPropertySize(urlRef: URLReference; property: ConstCStringPtr; VAR propertySize: Size): OSStatus;
  211. FUNCTION URLSetProperty(urlRef: URLReference; property: ConstCStringPtr; propertyBuffer: UNIV Ptr; bufferSize: Size): OSStatus;
  212. FUNCTION URLGetCurrentState(urlRef: URLReference; VAR state: URLState): OSStatus;
  213. FUNCTION URLGetError(urlRef: URLReference; VAR urlError: OSStatus): OSStatus;
  214.  
  215. FUNCTION URLIdle: OSStatus;
  216. FUNCTION URLGetFileInfo(fName: StringPtr; VAR fType: OSType; VAR fCreator: OSType): OSStatus;
  217.  
  218. { Error Codes }
  219.  
  220. CONST
  221.     kURLInternetAccessErrorCodeBase = -30770;
  222.     kURLInvalidURLReferenceError = -30770;
  223.     kURLProgressAlreadyDisplayedError = -30771;
  224.     kURLDestinationExistsError    = -30772;
  225.     kURLInvalidURLError            = -30773;
  226.     kURLUnsupportedSchemeError    = -30774;
  227.     kURLServerBusyError            = -30775;
  228.     kURLAuthenticationError        = -30776;
  229.     kURLPropertyNotYetKnownError = -30777;
  230.     kURLUnknownPropertyError    = -30778;
  231.     kURLPropertyBufferTooSmallError = -30779;
  232.     kURLUnsettablePropertyError    = -30780;
  233.     kURLInvalidCallError        = -30781;
  234.     kURLFileEmptyError            = -30783;
  235.     kURLExtensionFailureError    = -30785;
  236.     kURLInvalidConfigurationError = -30786;
  237.     kURLAccessNotAvailableError    = -30787;
  238.  
  239. {$ALIGN RESET}
  240. {$POP}
  241.  
  242. {$SETC UsingIncludes := URLAccessIncludes}
  243.  
  244. {$ENDC} {__URLACCESS__}
  245.  
  246. {$IFC NOT UsingIncludes}
  247.  END.
  248. {$ENDC}
  249.